<template>
	<view class="transfor">
		<view class="person">
			<view class="personTitle">
				<view class="personImg">
					<image :src="person.avatar"></image>
				</view>
				<view class="personText">
					<text>{{person.name}}</text>
					<text>({{person.code}})</text>
				</view>
			</view>
		</view>
		<view class="transforBox">
			<view class="transforTitle">转账金额</view>
			<view class="transforInput">
				<text>￥</text>
				<input type="number" v-model="money"/>
			</view>
			<view class="popUpBtn" @click="openPopUp">添加转账说明</view>
			<!-- <uni-popup ref="dialogInput" type="dialog" @change="change">
				<uni-popup-dialog mode="input" title="输入内容" value="对话框预置提示内容!" placeholder="请输入内容" @confirm="dialogInputConfirm"></uni-popup-dialog>
			</uni-popup> -->
			<input class="remark" type="text" v-model="remark" />
			<view class="transforBtn" @click="transforMoney">
				确认转账
			</view>
		</view>
		
	</view>
</template>

<script>
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	import {info} from "@/api/user";
	import {transferAccount} from "@/api/account";
	export default {
		components: {uniPopup},
		data() {
			return {
				uId:0,
				type:0,	
				person:{},
				money:Number,
				remark:'',
			}
		},
		methods: {
			async info(){
				const{data:res} = await info(this.uId)
				// console.log(res)
				this.person = res
			},
			// openPopUp(){
			// 	this.$refs.dialogInput.open()
			// },
			// closePopUp(done){
			// 	done()
			// },
			// confirm(done,value){
			// 	console.log(value)
			// 	done()
			// }
			async transforMoney(){
				// console.log(this.remark)
				const data = {
					toUserId:this.uId,
					remark:this.remark,
					amount:this.money,
					type:this.type
				}
				// console.log(data)
				const res = await transferAccount(data)
				// console.log(res)
				
				uni.navigateBack()
			}
		},
		onLoad(option) {
			this.uId = option.id
			this.type = option.type
			this.info()
		}
		
	}
</script>

<style lang="stylus" scoped>
.transfor
	height 100vh
	.person
		width 100%
		display flex
		justify-content center
		.personTitle
			.personImg
				width 80rpx
				height 80rpx
				margin 0 auto
				image
					width 80rpx
					height 80rpx
			.personText
				margin-top 18rpx
				display flex
				justify-content center
				
	.transforBox
		padding 90rpx 60rpx
		width 100%
		.transforTitle
			font-size 24rpx
			font-weight 300
		.transforInput
			display flex
			margin-top 60rpx
			text
				font-size 72rpx
				font-weight 600
			input
				width 100%
				height 100%
				font-size 72rpx
		.remark
			width 100%
			height 88rpx
			border 1rpx solid #DD524D
		.transforBtn
			width 100%
			height 88rpx
			background-color #F7895E
			display flex
			justify-content center
			align-items center
			color #fff
</style>
